package com.video.moderation.entity.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result implements Serializable {

    private static final long serialVersionUID = 1L;

    private int code;

    private String msg;

    private Object data;

    private final static int SUCCESS = 200;

    private final static int ERROR = 400;

    public static Result success() {
        return new Result(SUCCESS, null, null);
    }

    public static Result success(Object data) {
        return new Result(SUCCESS, null, data);
    }

    public static Result success(String msg) {
        return new Result(SUCCESS, msg, null);
    }

    public static Result success(String msg, Object data) {
        return new Result(SUCCESS, msg, data);
    }
    
    public static Result error() {
        return new Result(ERROR, null, null);
    }

    public static Result error(Object data) {
        return new Result(ERROR, null, data);
    }

    public static Result error(String msg) {
        return new Result(ERROR, msg, null);
    }

    public static Result error(String msg, Object data) {
        return new Result(ERROR, msg, data);
    }

}
